package com.shzu.jwc.ty.controller;

import com.shzu.jwc.ty.bean.SystemExamWeekly;
import com.shzu.jwc.ty.common.Msg;
import com.shzu.jwc.ty.service.ExamWeekService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ExamWeekController {

    @Autowired
    ExamWeekService examWeekService;

    @ResponseBody
    @RequestMapping("/getweek.action")
    public Msg getweek(){
        return Msg.success("获取成功").add("data",examWeekService.getweek());
    }

    @ResponseBody
    @RequestMapping("/insertweek.action")
    public Msg insert(SystemExamWeekly systemExamWeekly){
        try {
        	SystemExamWeekly data = examWeekService.insert(systemExamWeekly);
            return Msg.success("操作成功").add("data",data);
        }catch (Exception e){
            e.printStackTrace();
            return Msg.error("操作失败");
        }
    }

    @ResponseBody
    @RequestMapping("/deleteweek.action")
    public Msg delete(@RequestParam("systemExamWeeklyId") Integer systemExamWeeklyId){
        try {
            examWeekService.delete(systemExamWeeklyId);
            return Msg.success("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return Msg.error("操作失败");
        }
    }
}
